<div class="layui-form" lay-filter="layuiadmin-form-module" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">子系统</label>
        <div class="layui-input-inline">
            <script type="text/html" template="">
                        {{# if(d.params.sys){  }}
                            <input list="options" onfocus="sysdeal()" name="sys" lay-verify="required" class="layui-input" placeholder="请输入子系统名称" value="{{d.params.sys}}" autocomplete="off">
                        {{#}else{  }}
                            <input list="options" onfocus="sysdeal()" name="sys" lay-verify="required" class="layui-input" placeholder="请输入子系统名称" value="" autocomplete="off">
                        {{# }  }}
                <datalist id="options">

                </datalist>
            </script>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">二级菜单</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                {{# if(d.params.menu){  }}
                    <input list="options2" onfocus="menudeal()" name="menu" lay-verify="required" class="layui-input" placeholder="请输入子系统名称" value="{{d.params.menu}}" autocomplete="off">
                {{#}else{  }}
                    <input list="options2" onfocus="menudeal()" name="menu" lay-verify="required" class="layui-input" placeholder="请输入子系统名称" value="" autocomplete="off">
                {{# }  }}
                <datalist id="options2">
                </datalist>
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">功能模块</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="module" value="{{ d.params.module || '' }}" lay-verify="required"
                       placeholder="请输入功能模块" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">BI地址</label>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <input type="text" name="address" value="{{ d.params.bi || '' }}" lay-verify="required"
                       placeholder="请输入BI地址" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="LAY-module-front-submit" value="确认" class="layui-btn">
        </div>
    </div>
</div>

<script>

    function sysdeal() {
        var sys_lis = layui.data('menu').sys_lis
        var option_str = ''
        for (var i in sys_lis) {
            option_str = option_str + `<option value=${sys_lis[i]} >${sys_lis[i]}</option>`
        }
        $("#options").empty()
        $("#options").append(option_str)
    }

    function menudeal() {
        var sys_name = $("input[name='sys']").val()
        var option_str = ''
        var appoint_menu_lis = layui.data('menu').menu_obj[sys_name]
        for (var i in appoint_menu_lis) {
            option_str = option_str + `<option value=${appoint_menu_lis[i]} >${appoint_menu_lis[i]}</option>`
        }
        $("#options2").empty()
        $("#options2").append(option_str)

    }

</script>

